//package com.hzhc.config;
//
//import com.alibaba.fastjson2..JSONUtil;
//import com.hzhc.util.GzipUtil;
//import com.hzhc.vo.ResultVo;
//import org.springframework.core.MethodParameter;
//import org.springframework.http.MediaType;
//import org.springframework.http.converter.HttpMessageConverter;
//import org.springframework.http.server.ServerHttpRequest;
//import org.springframework.http.server.ServerHttpResponse;
//import org.springframework.stereotype.Component;
//import org.springframework.web.bind.annotation.ControllerAdvice;
//import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
//
///**
// * @ClassName: GlobalResponseBodyAdvice
// * @Description:
// * @version 1.0
// * @author: duanhm
// * @Date: 2023/11/17 21:32:28
// *
// */
//@Component
//@ControllerAdvice(basePackages = "com.hzhc.controller")
//public class GlobalResponseBodyAdvice implements ResponseBodyAdvice<Object> {
//
//	@Override
//	public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
//		// TODO Auto-generated method stub
//		return true;
//	}
//
//	@Override
//	public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType,
//			Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request,
//			ServerHttpResponse response) {
//		// TODO Auto-generated method stub
//		// application/json
//		String sctype = selectedContentType.getSubtype();
//		if (sctype.equals("json")) {
//			ResultVo vo = new ResultVo();
//			vo.setData(GzipUtil.gzip(body.toString()));
//			vo.setDataType("bodyjson");
//			return JSONUtil.toJsonStr(vo);
//		}
//		return body;
//	}
//
//}
